package design.prototype;

public class Key implements Cloneable {
    private Master master; // 钥匙主人
    private String keyName; // 名称
    public Key(String keyName) {
        this.keyName = keyName;
    }
    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
    public void openDoor() {
        master.useKey(this);
    }
    public void setMaster(Master master) {
        this.master = master;
    }
    public String getName() {
        return keyName;
    }
}
